#ifndef __DIRECTORY_OPERATION__
#define __DIRECTORY_OPERATION__

#include <my_header.h>                                                                                         
#include "fileTable.h"
#define MAX_STACK_SIZE 20

typedef struct pathStack_s{
    int stack[MAX_STACK_SIZE];
    int top;
    int restoreStack[MAX_STACK_SIZE];
    int top_r;
    MYSQL* mysql;
    int owner_id;
}pathStack_t;

int stackInit(pathStack_t* cur);  // 用户登录，将他的根目录入栈
int stackPath(fileMetaData_t* meta,pathStack_t* cur);
int pri_pwd(char* path,pathStack_t* cur);
int pri_cd(bool path_type,fileMetaData_t* meta,pathStack_t* cur);
int stackRestore(pathStack_t* cur);
int get_filename(fileMetaData_t* meta,pathStack_t* cur);  // 根据路径切出文件名
int pri_mkdir(bool path_type,fileMetaData_t* meta,pathStack_t* cur);
int pri_rmdir(bool path_type,fileMetaData_t* meta,pathStack_t* cur);
int pri_ls(bool path_type,fileMetaData_t* meta,pathStack_t* cur,char* res);
int pri_remove(bool path_type,fileMetaData_t* meta,pathStack_t* cur);

#endif
